Skip to content

Conversation

tgodzik
Copy link
Contributor

@tgodzik tgodzik commented Oct 2, 2025

@tgodzik tgodzik requested a review from zielinsky October 2, 2025 14:31
Copy link
Member

@zielinsky zielinsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@som-snytt
Copy link
Contributor

Not sure about this use case, but for linting I used

  extension (pos: SrcPos)
    def isZeroExtentSynthetic: Boolean = pos.span.isSynthetic && pos.span.isZeroExtent
    def isSynthetic: Boolean = pos.span.isSynthetic && pos.span.exists

and for message rendering I wanted to check if it's at EOF, for some reason I got nervous and put the source.length check after other conditions on the span

  // adjust a pos at EOF if preceded by newline
  private def adjust(pos: SourcePosition): SourcePosition =
    if pos.span.isSynthetic
    && pos.span.isZeroExtent
    && pos.span.exists
    && pos.span.start == pos.source.length
    && pos.source(pos.span.start - 1) == '\n'
    then
      pos.withSpan(pos.span.shift(-1))
    else
      pos

@tgodzik
Copy link
Contributor Author

tgodzik commented Oct 3, 2025

I think we should be good here, though it's one of the cases that I am lacking the reproduction, so it's only a guess here. The might have been zero extent, but not sure.

@tgodzik tgodzik merged commit 9f70200 into scala:main Oct 3, 2025
50 of 51 checks passed
@tgodzik tgodzik deleted the fix-array-issue branch October 3, 2025 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants